$(document).ready(function() {
	
	function getParams(){       //收集请求参数		
		var tId=$.trim($("#tId").val());
		var tTime=$.trim($("#tTime").val());		
		var advice=$.trim($("#advice").val());        //处置建议或退办理由		
		var tPerson=$.trim($("#tPerson").val());    //办结人
		params = {				
				"queryOption['taskid']":tId,
		 		"queryOption['toTime']":tTime,
				"queryOption['advice']":advice,	
				"queryOption['tPerson']":tPerson,	
				};
		return params;
	}
	
	function agreeAjax(d){
		$.ajax({
			type : "post",
			url: "lzw/TaskOver_directToOver.action",
			data : d,
			success : function(data){
			alert(data.message);
		}
       });
	}
	
	
	//办结
	$("#agree").click(function(){
		var tTime=$.trim($("#tTime").val());
		var advice=$.trim($("#advice").val());
		if(tTime==""||advice==""){
			  alert("请认真填写办结表各项内容！");
			  return;
		  }
		if(!confirm("确定要办结吗？"))
		{
			return;
		}
		else{
		    agreeAjax(getParams());
		    t = "window.location.href='/ag/zhh/task_over_request_list.jsp'";
		    window.setTimeout(t,2000);
		  }
	});	
	
	//返回
	$("#return").click(function(){
		 window.location.href="/ag/zhh/task_over_request_list.jsp";       
		});
	
});	

